import Taro from "@tarojs/taro";

const baseURL = "https://cnodejs.org"

function request(url, method, data) {
  // Taro API 都是支持Promise
  return new Promise((resolve) => {
    Taro.request({
      url: baseURL + url,
      method,
      data,
      success(res) {
        if (res && res.data.success) {
          resolve(res.data.data)
        }
      }
    })
  })
}

export default request;

// request("/api/v1/topics","GET",data)